<script type="text/javascript" src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/plugins/jquery-validation/dist/jquery.validate.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/plugins/jquery-validation/dist/additional-methods.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/plugins/bootstrap-wizard/jquery.bootstrap.wizard.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/plugins/chosen-bootstrap/chosen/chosen.jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/plugins/select2/select2.min.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/scripts/app.js"></script>
<script src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/scripts/form-wizard-account-complete.js"></script>
<script src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/scripts/maskedinput.min.js"></script>
<script src="<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/scripts/jquery.ui.datepicker-tr.js"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
    jQuery(document).ready(function() {
        // initiate layout and plugins
        App.init();
        FormWizard.init();
        $('.button-next').click();//sonraki aşamaya geçmesi için eklendi
        $("input[name='user[firstname]']").focusin();
        $("input[name='user[firstname]']").focusout();
        $("input[name='user[lastname]']").focusin();
        $("input[name='user[lastname]']").focusout();
        jQuery.extend(jQuery.validator.messages, {
            required: "This fsdsdsdsds is required.",
            remote: "Please fix this field.",
            email: "Please enter a valid email address.",
            url: "Please enter a valid URL.",
            date: "Please enter a valid date.",
            dateISO: "Please enter a valid date (ISO).",
            number: "Please enter a valid number.",
            digits: "Please enter only digits.",
            creditcard: "Please enter a valid credit card number.",
            equalTo: "Please enter the same value again.",
            accept: "Please enter a value with a valid extension.",
            maxlength: jQuery.validator.format("Please enter no more than {0} characters."),
            minlength: jQuery.validator.format("Please enter at least {0} characters."),
            rangelength: jQuery.validator.format("Please enter a value between {0} and {1} characters long."),
            range: jQuery.validator.format("Please enter a value between {0} and {1}."),
            max: jQuery.validator.format("Please enter a value less than or equal to {0}."),
            min: jQuery.validator.format("Please enter a value greater than or equal to {0}.")
        });
    });
</script>
    <!--Date Picker-->
<script>
    $(function() {
        $( "#datepicker" ).datepicker({
            //showOn: "both",
            //buttonImage: "<?php echo $this->baseUrl(false) . THEME_ASSETS_URL;?>/img/calendar.gif",
            changeMonth: true,
            changeYear: true,
            showAnim: 'fadeIn',
            //yearRange: '1930:+0' günümüze kadar
            yearRange: '1930:2000'

        });
        $.datepicker.setDefaults($.datepicker.regional['tr']);//dile göre değişsin
        $("input[name='user[date_of_birth]']").change(function() {
            $(this).focusin();
            $(this).focusout();
        });
    });


</script>
<!--Phone Validation-->
<script>
        jQuery(function($){
            $("#cellphone").mask("+99 999 999 9999")
                $("#cellphone").change(function() {
                    $(this).focusin();
                    $(this).focusout();
                });

        });
</script>

<script>
        jQuery(function($){
            $("#country_list").change(function(event) {

                /* stop form from submitting normally */
                event.preventDefault();

                /*clear result div*/
                $("#city_list").html('<option>loading</option>');

                /* get some values from elements on the page: */
                //var values = $("#countries option:selected").attr("value");
                //alert(values);
                /* Send the data using post and put the results in a div */
                $.ajax({
                    url: "<?php echo $this->url(array('module' => 'my','controller' => 'complete','action' => 'fillcities'));?>",
                    type: "post",
                    data: $(this),
                    success: function(data){
                        var cities = '';

                        var obj = $.parseJSON(data);
                        console.log(obj);

                        cities += '<option value="" >All Cities</option>';
                        $.each(obj, function() {

                            cities += '<option value="'+ this['city_id'] +'" countryid="'+ this['country_id']+'">'+ this['city_label_en'] + '</option>';

                        });
                        $("#cities").html(cities);
                        //$("#msg").html(data);

                    },
                    error:function(){
                        alert("failure");
                        $("#cities").html('<option>there is error while submit</option>');
                    }
                });
            });
        });
</script>